<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>预定义常量</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="pgsql.resources.html">« 资源类型</a></li>
      <li style="float: right;"><a href="pgsql.examples.html">范例 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.pgsql.html">PostgreSQL</a></li>
    <li>预定义常量</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="pgsql.constants" class="appendix">
 <h1>预定义常量</h1>

 <p class="simpara">下列常量由此扩展定义，且仅在此扩展编译入 PHP 或在运行时动态载入时可用。</p>

 <dl>
  
   <dt>

    <strong><code>PGSQL_ASSOC</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
      Passed to <span class="function"><a href="function.pg-fetch-array.html" class="function">pg_fetch_array()</a></span>. Return an associative array of field
      names and values.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_NUM</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
      Passed to <span class="function"><a href="function.pg-fetch-array.html" class="function">pg_fetch_array()</a></span>. Return a numerically indexed array of field
      numbers and values.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_BOTH</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
      Passed to <span class="function"><a href="function.pg-fetch-array.html" class="function">pg_fetch_array()</a></span>. Return an array of field values
      that is both numerically indexed (by field number) and associated (by field name).
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_CONNECT_FORCE_NEW</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
      Passed to <span class="function"><a href="function.pg-connect.html" class="function">pg_connect()</a></span> to force the creation of a new connection,
      rather then re-using an existing identical connection.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_CONNECTION_BAD</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
      Returned by <span class="function"><a href="function.pg-connection-status.html" class="function">pg_connection_status()</a></span> indicating that the database
      connection is in an invalid state.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_CONNECTION_OK</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
      Returned by <span class="function"><a href="function.pg-connection-status.html" class="function">pg_connection_status()</a></span> indicating that the database
      connection is in a valid state.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_SEEK_SET</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-lo-seek.html" class="function">pg_lo_seek()</a></span>. Seek operation is to begin
     from the start of the object.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_SEEK_CUR</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-lo-seek.html" class="function">pg_lo_seek()</a></span>. Seek operation is to begin
     from the current position.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_SEEK_END</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-lo-seek.html" class="function">pg_lo_seek()</a></span>. Seek operation is to begin
     from the end of the object.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_EMPTY_QUERY</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>. The string sent to the server
     was empty.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_COMMAND_OK</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>. Successful completion of a
     command returning no data.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_TUPLES_OK</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>. Successful completion of a command
     returning data (such as a <code class="literal">SELECT</code> or <code class="literal">SHOW</code>).
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_COPY_OUT</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>. Copy Out (from server) data
     transfer started.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_COPY_IN</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>. Copy In (to server) data
     transfer started.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_BAD_RESPONSE</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>. The server&#039;s response
     was not understood.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_NONFATAL_ERROR</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>. A nonfatal error
     (a notice or warning) occurred.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_FATAL_ERROR</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>. A fatal error
     occurred.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_TRANSACTION_IDLE</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-transaction-status.html" class="function">pg_transaction_status()</a></span>. Connection is
     currently idle, not in a transaction.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_TRANSACTION_ACTIVE</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-transaction-status.html" class="function">pg_transaction_status()</a></span>. A command
     is in progress on the connection.  A query has been sent via the connection
     and not yet completed.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_TRANSACTION_INTRANS</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-transaction-status.html" class="function">pg_transaction_status()</a></span>. The connection
     is idle, in a transaction block.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_TRANSACTION_INERROR</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-transaction-status.html" class="function">pg_transaction_status()</a></span>. The connection
     is idle, in a failed transaction block.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_TRANSACTION_UNKNOWN</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Returned by <span class="function"><a href="function.pg-transaction-status.html" class="function">pg_transaction_status()</a></span>. The connection
     is bad.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_SEVERITY</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     The severity; the field contents are <code class="literal">ERROR</code>,
     <code class="literal">FATAL</code>, or <code class="literal">PANIC</code> (in an error message), or
     <code class="literal">WARNING</code>, <code class="literal">NOTICE</code>, <code class="literal">DEBUG</code>,
     <code class="literal">INFO</code>, or <code class="literal">LOG</code> (in a notice message), or a localized
     translation of one of these. Always present.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_SQLSTATE</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     The SQLSTATE code for the error. The SQLSTATE code identifies the type of error
     that has occurred; it can be used by front-end applications to perform specific
     operations (such as error handling) in response to a particular database error.
     This field is not localizable, and is always present.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_MESSAGE_PRIMARY</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     The primary human-readable error message (typically one line). Always present.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_MESSAGE_DETAIL</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     Detail: an optional secondary error message carrying more detail about the problem. May run to multiple lines.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_MESSAGE_HINT</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     Hint: an optional suggestion what to do about the problem. This is intended to differ from detail in that it
     offers advice (potentially inappropriate) rather than hard facts. May run to multiple lines.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_STATEMENT_POSITION</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     A string containing a decimal integer indicating an error cursor position as an index into the original
     statement string. The first character has index 1, and positions are measured in characters not bytes.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_INTERNAL_POSITION</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     This is defined the same as the <strong><code>PG_DIAG_STATEMENT_POSITION</code></strong> field, but
     it is used when the cursor position refers to an internally generated
     command rather than the one submitted by the client. The
     <strong><code>PG_DIAG_INTERNAL_QUERY</code></strong> field will always appear when this
     field appears.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_INTERNAL_QUERY</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     The text of a failed internally-generated command. This could be, for example, a
     SQL query issued by a PL/pgSQL function.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_CONTEXT</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     An indication of the context in which the error occurred. Presently
     this includes a call stack traceback of active procedural language
     functions and internally-generated queries. The trace is one entry
     per line, most recent first.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_SOURCE_FILE</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     The file name of the PostgreSQL source-code location where the error
     was reported.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_SOURCE_LINE</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     The line number of the PostgreSQL source-code location where the
     error was reported.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_DIAG_SOURCE_FUNCTION</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-error-field.html" class="function">pg_result_error_field()</a></span>.
     The name of the PostgreSQL source-code function reporting the error.
    </span>
   </dd>

  

  
   <dt>

    <strong><code>PGSQL_ERRORS_TERSE</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-set-error-verbosity.html" class="function">pg_set_error_verbosity()</a></span>.
     Specified that returned messages include severity, primary text,
     and position only; this will normally fit on a single line.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_ERRORS_DEFAULT</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-set-error-verbosity.html" class="function">pg_set_error_verbosity()</a></span>.
     The default mode produces messages that include the above
     plus any detail, hint, or context fields (these may span
     multiple lines).
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_ERRORS_VERBOSE</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-set-error-verbosity.html" class="function">pg_set_error_verbosity()</a></span>.
     The verbose mode includes all available fields.
    </span>
   </dd>

  

  
   <dt>

    <strong><code>PGSQL_STATUS_LONG</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>.  Indicates that
     numerical result code is desired.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_STATUS_STRING</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-result-status.html" class="function">pg_result_status()</a></span>.  Indicates that
     textual result command tag is desired.
    </span>
   </dd>

  

  
   <dt>

    <strong><code>PGSQL_CONV_IGNORE_DEFAULT</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-convert.html" class="function">pg_convert()</a></span>.
     Ignore default values in the table during conversion.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_CONV_FORCE_NULL</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-convert.html" class="function">pg_convert()</a></span>.
     Use SQL <code class="literal">NULL</code> in place of an empty <span class="type">string</span>.
    </span>
   </dd>

  
  
   <dt>

    <strong><code>PGSQL_CONV_IGNORE_DEFAULT</code></strong>
    (<span class="type">integer</span>)
   </dt>

   <dd>

    <span class="simpara">
     Passed to <span class="function"><a href="function.pg-convert.html" class="function">pg_convert()</a></span>.
     Ignore conversion of <strong><code>null</code></strong> into SQL <code class="literal">NOT NULL</code> columns.
    </span>
   </dd>

  

 </dl>

</div>
</div></div></body></html>